import 'package:dk_flutter_base/dk_core.dart';
import 'package:dk_flutter_base/dk_ui.dart';
import 'package:dk_flutter_module_sale/common/config/page_base_common.dart';
import 'package:dk_flutter_module_sale/common/user_track/user_track.dart';
import 'package:dk_flutter_module_sale/config/route/sale_in_widget_route.dart';
import 'package:dk_flutter_module_sale/sale/api/sale_in_api.dart';
import 'package:dk_flutter_module_sale/sale/sale_in/contract_pay_failure/bean/bean_contract_payment_item.dart';
import 'package:dk_flutter_module_sale/sale/sale_in/contract_pay_failure/widget/widget_contract_pay_result.dart';

@ARoute(url: SaleInWidgetRoute.SALE_IN_CONTRACT_PAY_FAILURE)

class ContractPayFaiure extends CommonPageWithTrack {
  ContractPayFaiure(BoostRouteOption option) : super();

  @override
  void trackStatistics() {
    UserTrack.trackViewScreen("收房-付款失败-列表", null);
  }

  @override
  DkAppBar getAppBar(CommonPageBloc pageBloc) {
    return DkAppBar(DKAppBarParams.withBackMenu(pageBloc.context, _getNaviActionItems(pageBloc),titleContent: '付款失败'));
  }

 List<Widget> _getNaviActionItems(CommonPageBloc pageBloc){
   return [InkWell(
     child: Padding(
       padding: EdgeInsets.only(left: 15,right: 12),
       child: Center(
         child: DkText.simple('历史', 14, DkColor('0xFF999999'),fontWeight: FontWeight.normal),
       ),
     ),
     onTap: (){
       //todo 跳转历史页面
       RouteUtil.goPage(SaleInWidgetRoute.SALE_IN_CONTRACT_PAY_HISTORY,widgetContext:pageBloc.context);
     },
   )];
 }

  @override
  void onInitState(CommonPageBloc pageBloc) {
    pageBloc.pageHttpGet(
        path: SaleInApi.paymentFailureUrl,
        queryMap: {'execute_status':'进行中','page':1,'page_num':20},
        widgetBuilderByData: (dynamic data) {
          return PayResultListWidget(ContractPayResultListBean.fromJson(data), pageBloc,pageSource: 0,);
        });
  }
}

